package com.example.inventoryservice.company;

// 环境类 - 所得税计算器
public class IncomeTaxCalculator {

    private IncomeTaxStrategy strategy;

    public void setStrategy(IncomeTaxStrategy strategy) {
        this.strategy = strategy;
    }

    public TaxCalculationResult calculateTax(CompanyFinancialData data) {
        // 如果未设置策略，自动选择合适的策略
        if (strategy == null) {
            strategy = TaxStrategyFactory.getStrategy(data);
        }
        return strategy.calculate(data);
    }
}
